home *** CD-ROM | disk | FTP | other *** search
- property openButton, deleteButton, cancelButton, importButton, fileIndex, theNumberOfFiles, theContentList
- global openDialogBox, theScrollBar, fileMgr, toonDataFileList, PCflag, creditsEdited
-
- on birth me
- set openButton to 2
- set deleteButton to 3
- set cancelButton to 4
- set importButton to 5
- puppetSprites(openButton, importButton, 1)
- puppetSprites(20, 33, 1)
- puppetSprite(48, 1)
- set creditsEdited to 0
- if PCflag then
- set the textFont of field "filename field" to "Arial"
- set the textSize of field "filename field" to 10
- set the textStyle of field "filename field" to "bold"
- set the textFont of field "credits field" to "Arial"
- set the textSize of field "credits field" to 9
- set the textStyle of field "credits field" to "bold"
- set the textFont of field "file info field" to "Arial"
- set the textSize of field "file info field" to 9
- set the textStyle of field "file info field" to "bold"
- else
- set the textFont of field "filename field" to "Geneva"
- set the textSize of field "filename field" to 10
- set the textStyle of field "filename field" to "bold"
- set the textFont of field "credits field" to "Geneva"
- set the textSize of field "credits field" to 9
- set the textStyle of field "credits field" to "bold"
- set the textFont of field "file info field" to "Geneva"
- set the textSize of field "file info field" to 9
- set the textStyle of field "file info field" to "bold"
- end if
- return me
- end
-
- on init me
- set theNumberOfFiles to count(toonDataFileList)
- set fileIndex to theNumberOfFiles
- set toonDataFileInfo to getAt(toonDataFileList, fileIndex)
- set the text of field "filename field" to getAt(toonDataFileInfo, 1)
- set the text of field "credits field" to getAt(toonDataFileInfo, 2)
- set theContentList to getAt(toonDataFileInfo, 4)
- showThumbnails(me)
- if theNumberOfFiles > 1 then
- enable(theScrollBar)
- else
- disable(theScrollBar)
- end if
- updateFileInfoField(me)
- updateStage()
- end
-
- on updateFileInfoField me
- put "Cartoon" && fileIndex && "out of" && theNumberOfFiles into field "file info field"
- end
-
- on handleButton me, whichSprite
- if hiliteButton(whichSprite) then
- if whichSprite = openButton then
- openCartoon(me)
- else
- if whichSprite = deleteButton then
- deleteCartoon(me)
- else
- if whichSprite = importButton then
- importCartoon(me)
- else
- if whichSprite = cancelButton then
- hide(me)
- end if
- end if
- end if
- end if
- end if
- end
-
- on incrementFilePointer me
- if fileIndex < count(toonDataFileList) then
- set fileIndex to fileIndex + 1
- set toonDataFileInfo to getAt(toonDataFileList, fileIndex)
- set the text of field "filename field" to getAt(toonDataFileInfo, 1)
- set the text of field "credits field" to getAt(toonDataFileInfo, 2)
- set theContentList to getAt(toonDataFileInfo, 4)
- showThumbnails(me)
- updateFileInfoField(me)
- update(theScrollBar)
- updateStage()
- end if
- end
-
- on decrementFilePointer me
- if fileIndex > 1 then
- set fileIndex to fileIndex - 1
- set toonDataFileInfo to getAt(toonDataFileList, fileIndex)
- set the text of field "filename field" to getAt(toonDataFileInfo, 1)
- set the text of field "credits field" to getAt(toonDataFileInfo, 2)
- set theContentList to getAt(toonDataFileInfo, 4)
- showThumbnails(me)
- updateFileInfoField(me)
- update(theScrollBar)
- updateStage()
- end if
- end
-
- on hide me
- set the modal of openDialogBox to 0
- forget(openDialogBox)
- end
-
- on openCartoon me
- tell the stage
- readToonData(fileMgr, fileIndex)
- end tell
- hide(me)
- end
-
- on deleteCartoon me
- tell the stage
- deleteCartoon(fileMgr, fileIndex)
- end tell
- hide(me)
- end
-
- on importCartoon me
- tell the stage
- importToonData(fileMgr)
- end tell
- hide(me)
- end
-
- on update me, direction
- if ((fileIndex + direction) <> 0) and ((fileIndex + direction) <= theNumberOfFiles) then
- set fileIndex to fileIndex + direction
- set toonDataFileInfo to getAt(toonDataFileList, fileIndex)
- set the text of field "filename field" to getAt(toonDataFileInfo, 1)
- set the text of field "credits field" to getAt(toonDataFileInfo, 2)
- set theContentList to getAt(toonDataFileInfo, 4)
- showThumbnails(me)
- updateFileInfoField(me)
- update(theScrollBar)
- end if
- end
-
- on getCurrentFileNumber
- return fileIndex
- end
-
- on getTheNumberOfFiles
- return theNumberOfFiles
- end
-
- on showThumbnails me
- set positionTable to [[54, 54], [90, 54], [90, 90], [54, 90], [18, 90], [18, 54], [18, 18], [54, 18], [90, 18], [126, 18], [126, 54], [126, 90]]
- set bgdThumbnail to getAt(theContentList, 1)
- if bgdThumbnail = EMPTY then
- set bgdThumbnail to "DEFAULT"
- end if
- set bgdThumbnail to bgdThumbnail & ".thumb"
- set the loc of sprite 20 to point(94, 84)
- set the castNum of sprite 20 to the number of cast bgdThumbnail
- set listOfCharacters to getAt(theContentList, 2)
- set thumbnailSprite to 21
- set numberOfCharacters to count(listOfCharacters)
- repeat with i = 1 to 12
- if i <= numberOfCharacters then
- set castThumbnail to getAt(listOfCharacters, i)
- set thePoints to getAt(positionTable, i)
- set x to the left of sprite 20 + getAt(thePoints, 1)
- set y to the top of sprite 20 + getAt(thePoints, 2)
- set the loc of sprite thumbnailSprite to point(x, y)
- set the castNum of sprite thumbnailSprite to the number of cast (castThumbnail & ".thumb")
- else
- set the loc of sprite thumbnailSprite to point(-1000, 18)
- end if
- set thumbnailSprite to thumbnailSprite + 1
- end repeat
- end
-
- on clickedPreview me
- if creditsEdited then
- updateCredits(me)
- set creditsEdited to 0
- else
- openCartoon(me)
- end if
- end
-
- on updateCredits me
- set toonDataFileInfo to getAt(toonDataFileList, fileIndex)
- set oldCartoonCredits to getAt(toonDataFileInfo, 2)
- set newCartoonCredits to the text of field "credits field"
- setAt(getAt(toonDataFileList, fileIndex), 2, newCartoonCredits)
- if newCartoonCredits <> oldCartoonCredits then
- tell the stage
- updateToonData(fileMgr, fileIndex, newCartoonCredits, #open)
- end tell
- end if
- end
-